package token;

import java.util.ArrayList;
import java.util.List;
/**
 * 
 * @author Justin
 * 
 * Variable contains the various variable types and what they can do.
 */
public class Variable {
	Var_type type;
	String name;
	int var_int;
	String var_String;
	List<StringTuple> var_Strings;
	
	/**
	 * 
	 * @author Justin
	 * The various types of variables allowed in this class.
	 */
	public enum Var_type {	
		NOT_SET, STRING, INTEGER, STRING_LIST
	}
	
	
	public Variable(String name){
		this.name = name;
		type = Var_type.NOT_SET;
		var_Strings = new ArrayList<StringTuple>();
	}
	public Variable(String name, Var_type var){
		this.name = name;
		type = var;
		var_Strings = new ArrayList<StringTuple>();
	}
	public void setVar(Var_type var){
		type = var;
	}
	public Var_type getType(){
		return type;
	}
	public String getName(){
		return name;
	}
	public boolean setVar(int var){
		if (type == Var_type.INTEGER){
			var_int = var;
			return true;
		}
		return false;
	}
	public boolean setVar(String var){
		if (type == Var_type.STRING){
			var_String = var;
			return true;
		}
		return false;
	}
	public boolean setVar(List<StringTuple> vars){
		if (type == Var_type.STRING_LIST){
			var_Strings = vars;
			return true;
		}
		return false;
	}
	
	public List<StringTuple> getVar_Strings() {
		return this.var_Strings;
	}
	
	public int getVar_Int() {
		return this.var_int;
	}
}
